/**
 * 2009 # 11/08/2009 # 18:01:14
 * pratico
 */
package br.org.bertol.mestrado.engine.optimisation.entity;

import java.util.ArrayList;
import java.util.EnumMap;

import br.org.bertol.mestrado.engine.Objective;
import br.org.bertol.mestrado.engine.fitness.AbstractCombinatorialFitness;

/**
 * @author contaqualquer
 */
public class StoreResult<T> {

    /***/
    private final transient ArrayList<T>                    route;

    /***/
    private final transient EnumMap<Objective, String>      height;

    /***/
    private final transient AbstractCombinatorialFitness<T> abstractCombinatorialFitness;

    /**
     * Aramazena todos os resultados para consilidação.
     * @param rout
     *            Caminho
     * @param heig
     *            Valores consolidados
     * @param abstractCF
     *            Informação extra
     * @throws CloneNotSupportedException
     *             Erro ao clonar objeto
     */
    @SuppressWarnings("unchecked")
    StoreResult(final ArrayList<T> rout,
        final EnumMap<Objective, Number> heig,
        final AbstractCombinatorialFitness<T> abstractCF)
        throws CloneNotSupportedException {
        super();
        this.route = (ArrayList<T>) rout.clone();

        this.height = new EnumMap<Objective, String>(Objective.class);

        for (final Objective objective : heig.keySet()) {

            height.put(objective, objective.formatValue(heig.get(objective)));

        }

        this.abstractCombinatorialFitness = (AbstractCombinatorialFitness<T>) abstractCF
                .clone();
    }

    /**
     * Construtor padrão.
     */
    StoreResult() {
        route = new ArrayList<T>();

        height = new EnumMap<Objective, String>(Objective.class);

        abstractCombinatorialFitness = null;
    }

    /**
     * @return the route
     */
    public final String getRoute() {
        return route.toString();
    }

    /**
     * @return the height
     */
    public final EnumMap<Objective, String> getHeight() {
        return height;
    }

    /**
     * @return the abstractCombinatorialFitness
     */
    public final String getAbstractCombinatorialFitness() {
        return abstractCombinatorialFitness.toString();
    }

}
